package com.pattern.singleton.lazy;

/***
 * 懒汉式单例
 */
public class LazySingleton {
    private static LazySingleton lazy;
    private LazySingleton(){}
    public static LazySingleton getInstance(){
        if (lazy == null){
            synchronized (LazySingleton.class){
                if(lazy == null){
                    lazy = new LazySingleton();
                }
            }
        }
        return lazy;
    }
}
